﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace WebGetter
{
    public class Logger
    {
        List<TextWriter> writers = new List<TextWriter>();

        private static Logger current = null;
        public static Logger Current
        {
            get { return current ?? new Logger(); }
            set { current = value; }
        }

        public void RegistWriter(TextWriter writer)
        {
            if (!writers.Contains(writer))
            {
                writers.Add(writer);
            }
        }

        public void Log(string message)
        {
            foreach (var writer in writers)
            {
                writer.WriteLine("{0}\t{1}", DateTime.Now, message);
            }
        }
    }
}
